<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once BASE_PATH.'application/controllers/base'.EXT;

class Home extends Base {
	
        public function __construct() {
        parent::__construct();
        $this->load->model('moduleDAO');
        $this->load->model('adsDAO');
        $this->load->model("sessionDAO");
        $this->load->model("suscriptoresDAO");
    	}

       
       
	public function index()
	{
	      /*
		     Modulos
	      */
	      $carrusel		= $this->moduleDAO->getResultByStringId("home_carrusel");
	      
	      $videos		= $this->moduleDAO->getResultByStringId("home_videos");
	      $notas		= $this->moduleDAO->getResultByStringId("home_notas");
		  $grupero		= $this->moduleDAO->getResultByStringId("home_grupero");
	      $galerias		= $this->moduleDAO->getResultByStringId("home_galerias");
	      $farandula	= $this->moduleDAO->getResultByStringId("home_farandula");
	      $lomasleido	= $this->moduleDAO->getResultByStringId("home_lomasleido");
	      
	      
	      $estasemana = $this->moduleDAO->getParamsByStringId("home_estasemana");
	      
	      /*
		     Publicidad
	      */
	      $publicidadheader1 = $this->adsDAO->getAdsense("home_publicidadheader");
	      //$publicidadheader2 = $this->adsDAO->getAdsense("home_publicidadheader2");
	      
	      $publicidadmiddle1  = $this->adsDAO->getAdsense("home_publicidadmiddle1");
	      $publicidadmiddle2  = $this->adsDAO->getAdsense("home_publicidadmiddle2");

	      $publicidadbox1 	 = $this->adsDAO->getAdsense("home_publicidadboxbanner1");
	      $publicidadbox2 	 = $this->adsDAO->getAdsense("home_publicidadboxbanner2");
	      $publicidadfooter  = $this->adsDAO->getAdsense("home_publicidadfooter");
	      

	      $data = array(
			    "header" => array(
					  "title"			=> "Home",
					  "subtitle" 			=> "",
					  "description"			=> "",
					  "keywords"			=> ""
					  ),
			    // Modulos
			    "carrusel" 		=> $carrusel,
			    "videos"		=> $videos,
			    "notas"		=> $notas,
			    "galerias"		=> $galerias,
			    "farandula"		=> $farandula,
			    "lomasleido"	=> $lomasleido,
			    "estasemana"	=> $estasemana,
				"grupero"	=> $grupero,
			    
			    // Publicidad
			    "publicidadheader1" => $publicidadheader1,
			    "publicidadheader2" => $publicidadheader2,
			    "publicidadbox1" 	=> $publicidadbox1,
			    "publicidadbox2" 	=> $publicidadbox2,
			    "publicidadmiddle1"	=> $publicidadmiddle1,
			    "publicidadmiddle2"	=> $publicidadmiddle2,
			    "publicidadfooter" 	=> $publicidadfooter,
			    );
	      
	      $this->load->view('home/home',$data);

	}
	
	 public function restaurar($item = '') {

        $data = array("title" => "Ooorale!",
            "subtitle" => "",
            "keywords" => "",
            "description" => "",
            "lista" => "",
            "session" => $this->sessionDAO->getUser());

        $this->load->view("header", $data);

        if (($item == "")) {
            redirect('/');
            die();
        }
	$usuario = $this->suscriptoresDAO->findUserByEmailEnc($item);
        if ((empty($usuario))) {
            redirect('/');
            die();
        }
	$datos = array("usuario" => $usuario
        );

	//$this->load->view("menu");

        $this->load->view("suscripciones/restaurar", $datos);

        //$this->load->view("footer");
    }



}